<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <title>个人中心</title>
    <link rel="stylesheet" href="../css/page-health-orderNotice.css"/>
    <link rel="stylesheet" href="../css/gr-personal-center.css"/>
    <script src="../plugins/jquery/dist/jquery.min.js"></script>
    <script src="../plugins/healthmobile.js"></script>
    <script src="../plugins/vue/vue.js"></script>
    <script src="../plugins/vue/axios-0.18.0.js"></script>
    <link rel="stylesheet" href="../plugins/element-ui/lib/theme-chalk/index.css"/>
    <script src="../plugins/element-ui/lib/index.js"></script>

    <style>

        .order-btn {
            width: 100%;
            font-size: 18px;
            color: #fff;
            border-radius: 10px;
            padding: 3.6% 0;
            border: none;
            background-image: linear-gradient(90deg, #26acff, #0088dc);
        }

        .gr-hr-style-1 {
            border: none;
            border-top: 20px solid #E8E8E8;
        }

        .gr-hr-style-2 {
            border: none;
            border-top: 2px solid #E8E8E8;
        }

        .gr-el-col-6 {
            height: 40px;
            padding-left: 40px;
            padding-top: 6px;
        }

        .gr-el-col-18 {
            height: 40px;
            color: #BABABA;
            padding-top: 6px;
        }


    </style>

</head>
<body>

<div id="app" class="app">
    <!-- 页面头部 -->
    <div class="top-header">
        <span class="f-left"><i class="icon-back" onclick="history.go(-1)"></i></span>
        <span class="center">传智健康</span>
        <span class="f-right">
            <el-row class="block-col-2">
                <el-dropdown trigger="click">
                    <span class="el-dropdown-link">
                        <i class="el-icon-more"></i>
                    </span>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item icon="el-icon-s-home">
                            <el-button type="text"
                                       @click="toIndex()">首&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;页</el-button>
                        </el-dropdown-item>
                        <el-dropdown-item icon="el-icon-film">
                            <el-button type="text" @click="toHistoryRecord()">历史预约</el-button>
                        </el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-row>
        </span>
    </div>
    <!-- 页面内容 -->
    <div class="contentBox">
        <div class="notice-article">
            <div class="info-title">
                <span class="gr-name">账号资料</span>
            </div>
            <hr class="gr-hr-style-1"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">用户名</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{personalData.name == null ? '未设置' : personalData.name}}</div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">性别</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{personalData.sex == null ? '未设置' : personalData.sex == 1 ? '男' : '女'}}
                    </div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">手机号</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{personalData.phoneNumber == null ? '未设置' : personalData.phoneNumber}}
                    </div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">身份证号码</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{personalData.idCard == null ? '未设置' : personalData.idCard}}</div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">生日</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{birthday == null ? '未设置' : birthday}}</div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">邮箱</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{personalData.email == null ? '未设置' : personalData.email}}</div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>

            <el-row>
                <el-col :span="6">
                    <div class="gr-el-col-6">注册日期</div>
                </el-col>
                <el-col :span="18">
                    <div class="gr-el-col-18">{{regTime == null ? '未设置' : regTime}}</div>
                </el-col>
            </el-row>
            <hr class="gr-hr-style-2"/>


            <div class="box-button">
                <button @click="changePersonalCenter()" type="button" class="btn order-btn">修改个人信息</button>
            </div>

        </div>
    </div>
</div>
</div>

</body>

<script>
    var vue = new Vue({
        el: '#app',
        data: {

            labelPosition: 'left',
            personalData: {},
            birthday: '',
            regTime: ''

        },

        methods: {

            getMyCookie(key) {
                var val = "";
                // 对cookie操作
                var cookies = document.cookie;
                cookies = cookies.replace(/\s/, "");
                var cookie_array = cookies.split(";");
                for (i = 0; i < cookie_array.length; i++) {
                    // yh_mch=lilei
                    var cookie = cookie_array[i];
                    var array = cookie.split("=");
                    if (array[0] == key) {
                        val = array[1];
                    }
                }
                return val;
            },

            toIndex() {
                window.location.href = "index.html";
            },

            toHistoryRecord() {
                window.location.href = "historyRecord.html";
            },

            findInfo() {

                let telephone = this.getMyCookie("telephone");

                axios.get("/personalCenter/getPersonData.do?telephone=" + telephone).then((resp) => {
                    if (resp.data.flag) {
                        this.personalData = resp.data.data;
                        birthdayStr = resp.data.data.birthday;
                        if (birthdayStr != null) {
                            birthday = new Date(birthdayStr);
                            this.birthday = birthday.getFullYear() + "年" + (birthday.getMonth() + 1) + "月" + birthday.getDate() + "日";
                        }
                        regTimeStr = resp.data.data.regTime;
                        if (regTimeStr != null) {
                            regTime = new Date(regTimeStr);
                            this.regTime = regTime.getFullYear() + "年" + (regTime.getMonth() + 1) + "月" + regTime.getDate() + "日";
                        }
                    }
                });
            },

            changePersonalCenter() {
                window.location.href = "modifyPersonalCenter.html";
            }
        },

        created() {
            this.findInfo();
        }

    });
</script>

</html>